<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/4/15
  Time: 14:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--核心标签库--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<div>
    <img src="${pageContext.request.contextPath}/admin_img/logo.png" />
</div>
<div style="float: right">
    <c:if test="${ empty admin}">
        <a href="javascript:void(0)" onclick="btn_login()" >请登录</a>
    </c:if>
    <c:if test="${not empty admin}">
        恭喜,${admin.username}
       <%-- <a href="${pageContext.request.contextPath}/logOut">【退出】</a>--%>
        <%--超链接失效--%>
        <a href="javascript:void(0)" onclick="btn_logOut()">【退出】</a>
    </c:if>
</div>



</body>
<script>

    function btn_login(){
        //点击登录,打开登录页面
        top.location.href="${pageContext.request.contextPath}/admin/admin_login.jsp"
    }
    function btn_logOut(){
        alert("点击退出了") ;
        //window:代表窗口对象
        //window.loaction.href="加载地址":窗口打开一个页面
        //top.laction.href="从顶部弹出一个页面"
        top.location.href ="${pageContext.request.contextPath}/admin?methodName=admin_logOut" ;
    }
</script>
</html>
